package com.sbdo.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.sbdo.service.DemoService;

import com.sbdo.service.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/consumer/demo")
public class ConsumerDemoController {

    /**
     * 调用 provider
     */
    @Reference
    private DemoService demoService;

    @Reference
    private UserService userService;

    /**
     * demo
     */
    @RequestMapping("/getMsg")
    public String getMag(String name){
        return demoService.sayHello(name + "consumer1");
    }

    /**
     * provider-b 作为消费者调用 provider-a
     */
    @RequestMapping("/getMsgB")
    public String getMsgB(String msgb){
        return userService.rpcProviderByB(msgb + ":consumer_1");
    }


}